VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Command"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim cid As Integer

Public Sub setcid(nid As Integer) 'Change the current id of the player whose command is being processed.
cid = nid
End Sub

Public Sub move(arg) 'Move
curloc = Findroomloc(Players(cid).loc) 'Find the current location
rooms(curloc).userleave

Debug.Print arg
End Sub

Public Sub lgn(arg) 'Log in
Dim usn As String
Dim pass As String
Dim md As New clsMD5

'On Error GoTo errh
usn = Split(arg, "|")(0)
pass = (Split(arg, "|")(1))

#If HASH_PSWD Then 'If we are supposed to hash the password, hash it. Notice the compile time if :D
    pass = md5.CalculateMD5(pass)
#End If

If Getprop(usn & "." & pass) = pass Then
    'you are logged in
    Players(cid).login usn, pass
    'Players(cid).usn = usn
    'Players(cid).pass = pass
End If

'errh:
End Sub

Public Sub say(arg) 'Say a particular thing to a particular socket
Sendto cid, arg
End Sub

Public Sub look(arg)
Dim curloc As Integer
Dim xplay() As String

curloc = Findroomloc(Players(cid).loc)
say "MSG " & rooms(curloc).description
xplay = Split(Findplayerloc(Players(cid).loc), "|")

For x = 1 To UBound(xplay) - 1
say "MSG " & Players(CDbl(xplay(x))).username & " is here"
Next x

End Sub

Public Sub quit(arg)
If Form1.Sock(cid).state = 7 Then 'The client is still connected, tell them
    say "MSG " & QUITMSG
    say "QUIT"
End If

'Clean up the player
curloc = Findroomloc(Players(cid).loc) 'Find the current location
rooms(curloc).userleave

Set Players(cid) = Nothing
Set Players(cid) = New Player

Form1.Sock(cid).Close
End Sub
